﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="top.aspx.cs" Inherits="Easy.Web.Pages.DataPages.top" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="/_css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/_js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/_js/bootstrap.min.js" type="text/javascript"></script>
    <style type="text/css">
        body {
            background-color: #293038;
            font-size: 14px;
            font-family: 'Microsoft YaHei';
        }

        a {
            text-decoration: none;
            color: #fff;
            text-align: center;
            line-height: 50px;
            display: inline-block;
        }

            a:hover, a:active, a:visited, a:focus {
                text-decoration: none;
                background-color: rgb(52,73,94);
                color: #fff;
            }

        .top-left a {
            float: left;
            height: 50px;
        }

        .top-right {
            float: right;
        }

            .top-right a {
                padding: 0 10px;
            }
    </style>
</head>
<body>

    <div class="top-left" style="display:inline-block;cursor:pointer">
        <span id="zoom" style="color: #fffff3;display:inline;padding: 0 10px; line-height: 50px;" class="glyphicon glyphicon-chevron-left"></span>

    </div>
    <div class="top-right">
        <a currentuserid="<%=this.CurrentUserId %>" href="/Pages/DataPages/Form/FormPage.aspx?entityname=systemuser&id=<%=this.CurrentUserId %>" target="_blank"><span><%=this.GetSystemUser().Name %></span></a>
        <a href="/changepassword.aspx" target="_blank"><span>修改密码</span></a>
        <a href="javascript:Logout();"><span>退出</span></a>
    </div>
    <script type="text/javascript">
        var getElementsByClassName = function (searchClass, node, tag) {
            if (document.getElementsByClassName) {
                var nodes = (node || document).getElementsByClassName(searchClass), result = [];
                for (var i = 0 ; node = nodes[i++];) {
                    if (tag !== "*" && node.tagName === tag.toUpperCase()) {
                        result.push(node)
                    }
                }
                return result
            } else {
                node = node || document;
                tag = tag || "*";
                var classes = searchClass.split(" "),
                elements = (tag === "*" && node.all) ? node.all : node.getElementsByTagName(tag),
                patterns = [],
                current,
                match;
                var i = classes.length;
                while (--i >= 0) {
                    patterns.push(new RegExp("(^|\\s)" + classes[i] + "(\\s|$)"));
                }
                var j = elements.length;
                while (--j >= 0) {
                    current = elements[j];
                    match = false;
                    for (var k = 0, kl = patterns.length; k < kl; k++) {
                        match = patterns[k].test(current.className);
                        if (!match) break;
                    }
                    if (match) result.push(current);
                }

                return result;
            }
        }

        window.onload = function () {

            var top_title;
            if ($.trim($("#top_title").html()).length == 0) {
                top_title = "Easy开发框架";
                $("#top_title").html(top_title);
            }
            else {
                top_title = $.trim($("#top_title").html());
            }
            var frm = self.parent.document.getElementsByTagName("frameset")[0];
            frm.previousElementSibling.firstElementChild.innerHTML = top_title;
            if ($.trim($("#app_jpg").attr("href")).length != 0) {
                var apppath = $("#app_jpg").attr("href");
                $("#app_jpg").mouseenter(function () {
                    var main_body = window.parent.frames["main"].document.body;
                    var oDiv = document.createElement('div');
                    oDiv.id = "app_jpg_box";
                    oDiv.setAttribute("class", "app_jpg_box");
                    oDiv.style.position = "fixed";
                    oDiv.style.zIndex = "20";
                    oDiv.style.top = "0px";
                    oDiv.style.right = "264px";
                    oDiv.style.border = "1px solid #808080";
                    oDiv.innerHTML = '<img class="app_jpg" src="' + apppath + '" style="position:inherit;"/>';
                    main_body.appendChild(oDiv);
                    //$(parent.frames["main"].document.body).append('<div class="app_jpg_box" style="position:fixed;z-index:20;top:0px;border:1px solid #808080;"><img class="app_jpg" src="/_imgs/app.jpg" style="position:inherit;"/></div>');
                });
                $("#app_jpg").mouseleave(function () {
                    var removeDiv_body = window.parent.frames["main"].document.body;
                    //removeDiv.removeChild(window.parent.frames["main"].document.getElementsByClassName("app_jpg_box")[0]);
                    removeDiv_body.removeChild(window.parent.frames["main"].document.getElementById("app_jpg_box"));
                });
            }
            else {
                $("#app_jpg").remove();
            }
        }

        function Logout() {
            if (confirm("是否退出？")) {
                window.parent.location.href = "/login.aspx?logout=1";
            }
        }

        $("#zoom").click(function () {
            if ($("#zoom").hasClass("glyphicon-chevron-left")) {
                $("#zoom").removeClass("glyphicon-chevron-left");
                $("#zoom").addClass("glyphicon-chevron-right");
                if (window.top != null) {
                    window.top.zoom();
                }
            }
            else {
                $("#zoom").removeClass("glyphicon-chevron-right");
                $("#zoom").addClass("glyphicon-chevron-left");
                if (window.top != null) {
                    window.top.zoom();
                }
            }
        });
    </script>
</body>
</html>
